package memory;

public class MemoryUtil {

	public static void  printMemory() {
		  
		  StringBuilder builder = new StringBuilder();
		  builder.append("Free: ");
		  builder.append(bytesToMegabytes(Runtime.getRuntime().freeMemory()));
		  builder.append(" / Max: ");
		  builder.append(bytesToMegabytes(Runtime.getRuntime().maxMemory()));
		  builder.append(" / Total in use: ");
		  builder.append(bytesToMegabytes(Runtime.getRuntime().totalMemory()));
		  builder.append(".");
		  
		  System.out.println(builder);
	}
	
	private static long bytesToMegabytes(long bytes) {
		return ((bytes / 1024) /1024);
	}

}
